//
//  QiDongVC.m
//  夺宝吧
//
//  Created by xiaocai on 15/8/12.
//  Copyright (c) 2015年 FangYuan. All rights reserved.
//

#import "QiDongVC.h"

@interface QiDongVC ()
{
    UIImageView *bg;
    UIImageView *imgview;
}
@end

@implementation QiDongVC
- (void)viewDidAppear:(BOOL)animated
{
    [UIView animateWithDuration:0.45 animations:^{
        imgview.alpha = 1;
    } completion:^(BOOL finished) {
        [NSThread sleepForTimeInterval:1.0];
        [UIView animateWithDuration:2.0 animations:^{
            imgview.alpha = 0.6;
            bg.alpha = 0.7;
        } completion:^(BOOL finished) {
            //退出登录界面
//            [WYPublic logOrRegistSuccess];
                AppDelegate *app = [UIApplication sharedApplication].delegate;
                app.window.rootViewController = app.rtVC;
        }];

    }];

}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = QBB_GRAY_COLOR;
    bg = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, WYMWITH, WYMHEIGHT)];
    NSString *imgname = @"default-667h";
    if (WYMHEIGHT == 480) {
        imgname = @"default";
    }
    if (WYMHEIGHT == 568) {
        imgname = @"default-568h";
    }
    if (WYMHEIGHT == 736) {
        imgname = @"default-736h";
    }
    bg.image = [UIImage imageNamed:imgname];
    [self.view addSubview:bg];
    
    imgview = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, WYMWITH, WYMHEIGHT - 75*AUTOY)];
    imgview.alpha = 0.5;

    imgview.image = [self getImg];
//    imgview.contentMode = UIViewContentModeScaleToFill;
    [self.view addSubview:imgview];
    
    
}
- (UIImage *)getImg
{
    NSString *imageName = [NSString stringWithFormat:@"qidong_pic.jpg"];
    
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *fullPathToFile = [documentsDirectory stringByAppendingPathComponent:imageName];
    
    UIImage * img = [UIImage imageWithContentsOfFile:fullPathToFile];
    return img;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
